home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / MacWindows.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  26.3 KB  |  786 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        MacWindows.h
  3.  
  4.      Contains:    Window Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __MACWINDOWS__
  19. #define __MACWINDOWS__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __MIXEDMODE__
  25. #include <MixedMode.h>
  26. #endif
  27. #ifndef __QUICKDRAW__
  28. #include <Quickdraw.h>
  29. #endif
  30. #ifndef __EVENTS__
  31. #include <Events.h>
  32. #endif
  33. #ifndef __CONTROLS__
  34. #include <Controls.h>
  35. #endif
  36.  
  37.  
  38.  
  39. #if PRAGMA_ONCE
  40. #pragma once
  41. #endif
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. #if PRAGMA_IMPORT
  48. #pragma import on
  49. #endif
  50.  
  51. #if PRAGMA_STRUCT_ALIGN
  52.     #pragma options align=mac68k
  53. #elif PRAGMA_STRUCT_PACKPUSH
  54.     #pragma pack(push, 2)
  55. #elif PRAGMA_STRUCT_PACK
  56.     #pragma pack(2)
  57. #endif
  58.  
  59. /*
  60.   _________________________________________________________________________________________________________
  61.       
  62.    • WINDOW DEFINITION TYPE
  63.   _________________________________________________________________________________________________________
  64. */
  65.  
  66. enum {
  67.     kWindowDefProcType            = FOUR_CHAR_CODE('WDEF')
  68. };
  69.  
  70. /*
  71.   _________________________________________________________________________________________________________
  72.       
  73.    • WINDOW DEFINITION ID'S
  74.   _________________________________________________________________________________________________________
  75. */
  76.  
  77.  
  78. enum {
  79.     kStandardWindowDefinition    = 0,                            /* for document windows and dialogs*/
  80.     kRoundWindowDefinition        = 1,                            /* old da-style window*/
  81.     kFloatingWindowDefinition    = 124                            /* for floating windows*/
  82. };
  83.  
  84. /*
  85.   _________________________________________________________________________________________________________
  86.       
  87.    • VARIANT CODES
  88.   _________________________________________________________________________________________________________
  89. */
  90.  
  91.  
  92. enum {
  93.                                                                 /* for use with kStandardWindowDefinition */
  94.     kDocumentWindowVariantCode    = 0,
  95.     kModalDialogVariantCode        = 1,
  96.     kPlainDialogVariantCode        = 2,
  97.     kShadowDialogVariantCode    = 3,
  98.     kMovableModalDialogVariantCode = 5,
  99.     kAlertVariantCode            = 7,
  100.     kMovableAlertVariantCode    = 9,                            /* for use with kFloatingWindowDefinition */
  101.     kSideFloaterVariantCode        = 8
  102. };
  103.  
  104. /*
  105.   _________________________________________________________________________________________________________
  106.       
  107.    • PROC-ID'S
  108.   _________________________________________________________________________________________________________
  109. */
  110.  
  111.  
  112. enum {
  113.     documentProc                = 0,
  114.     dBoxProc                    = 1,
  115.     plainDBox                    = 2,
  116.     altDBoxProc                    = 3,
  117.     noGrowDocProc                = 4,
  118.     movableDBoxProc                = 5,
  119.     zoomDocProc                    = 8,
  120.     zoomNoGrow                    = 12,
  121.     rDocProc                    = 16,                            /* floating window defproc ids */
  122.     floatProc                    = 1985,
  123.     floatGrowProc                = 1987,
  124.     floatZoomProc                = 1989,
  125.     floatZoomGrowProc            = 1991,
  126.     floatSideProc                = 1993,
  127.     floatSideGrowProc            = 1995,
  128.     floatSideZoomProc            = 1997,
  129.     floatSideZoomGrowProc        = 1999
  130. };
  131.  
  132. /*
  133.   _________________________________________________________________________________________________________
  134.       
  135.    • STANDARD WINDOW KINDS
  136.   _________________________________________________________________________________________________________
  137. */
  138.  
  139.  
  140. enum {
  141.     dialogKind                    = 2,
  142.     userKind                    = 8,
  143.     kDialogWindowKind            = 2,
  144.     kApplicationWindowKind        = 8
  145. };
  146.  
  147.  
  148. /*
  149.   _________________________________________________________________________________________________________
  150.       
  151.    • FIND WINDOW RESULT CODES
  152.   _________________________________________________________________________________________________________
  153. */
  154.  
  155.  
  156. enum {
  157.     inDesk                        = 0,
  158.     inNoWindow                    = 0,
  159.     inMenuBar                    = 1,
  160.     inSysWindow                    = 2,
  161.     inContent                    = 3,
  162.     inDrag                        = 4,
  163.     inGrow                        = 5,
  164.     inGoAway                    = 6,
  165.     inZoomIn                    = 7,
  166.     inZoomOut                    = 8
  167. };
  168.  
  169.  
  170. enum {
  171.     wDraw                        = 0,
  172.     wHit                        = 1,
  173.     wCalcRgns                    = 2,
  174.     wNew                        = 3,
  175.     wDispose                    = 4,
  176.     wGrow                        = 5,
  177.     wDrawGIcon                    = 6
  178. };
  179.  
  180.  
  181. enum {
  182.     deskPatID                    = 16
  183. };
  184.  
  185. /*
  186.   _________________________________________________________________________________________________________
  187.       
  188.    • WINDOW DEFINITION HIT TEST RESULT CODES ("WINDOW PART")
  189.   _________________________________________________________________________________________________________
  190. */
  191.  
  192.  
  193. enum {
  194.     wNoHit                        = 0,
  195.     wInContent                    = 1,
  196.     wInDrag                        = 2,
  197.     wInGrow                        = 3,
  198.     wInGoAway                    = 4,
  199.     wInZoomIn                    = 5,
  200.     wInZoomOut                    = 6
  201. };
  202.  
  203. /*
  204.   _________________________________________________________________________________________________________
  205.       
  206.    • WINDOW COLOR PART CODES
  207.   _________________________________________________________________________________________________________
  208. */
  209.  
  210.  
  211. enum {
  212.     wContentColor                = 0,
  213.     wFrameColor                    = 1,
  214.     wTextColor                    = 2,
  215.     wHiliteColor                = 3,
  216.     wTitleBarColor                = 4
  217. };
  218.  
  219. /*
  220.   _________________________________________________________________________________________________________
  221.    • WINDOW COLOR TABLE STRUCTURE
  222.   _________________________________________________________________________________________________________
  223. */
  224.  
  225. struct WinCTab {
  226.     long                             wCSeed;                        /* reserved */
  227.     short                             wCReserved;                    /* reserved */
  228.     short                             ctSize;                        /* usually 4 for windows */
  229.     ColorSpec                         ctTable[5];
  230. };
  231. typedef struct WinCTab WinCTab;
  232.  
  233. typedef WinCTab *                        WCTabPtr;
  234. typedef WCTabPtr *                        WCTabHandle;
  235. /*
  236.   _________________________________________________________________________________________________________
  237.    • WINDOWRECORD
  238.   _________________________________________________________________________________________________________
  239. */
  240. typedef struct WindowRecord             WindowRecord;
  241. typedef WindowRecord *                    WindowPeek;
  242. struct WindowRecord {
  243.     GrafPort                         port;
  244.     short                             windowKind;
  245.     Boolean                         visible;
  246.     Boolean                         hilited;
  247.     Boolean                         goAwayFlag;
  248.     Boolean                         spareFlag;
  249.     RgnHandle                         strucRgn;
  250.     RgnHandle                         contRgn;
  251.     RgnHandle                         updateRgn;
  252.     Handle                             windowDefProc;
  253.     Handle                             dataHandle;
  254.     StringHandle                     titleHandle;
  255.     short                             titleWidth;
  256.     ControlHandle                     controlList;
  257.     WindowPeek                         nextWindow;
  258.     PicHandle                         windowPic;
  259.     long                             refCon;
  260. };
  261.  
  262. /*
  263.   _________________________________________________________________________________________________________
  264.    • CWINDOWRECORD
  265.   _________________________________________________________________________________________________________
  266. */
  267. typedef struct CWindowRecord             CWindowRecord;
  268. typedef CWindowRecord *                    CWindowPeek;
  269. struct CWindowRecord {
  270.     CGrafPort                         port;
  271.     short                             windowKind;
  272.     Boolean                         visible;
  273.     Boolean                         hilited;
  274.     Boolean                         goAwayFlag;
  275.     Boolean                         spareFlag;
  276.     RgnHandle                         strucRgn;
  277.     RgnHandle                         contRgn;
  278.     RgnHandle                         updateRgn;
  279.     Handle                             windowDefProc;
  280.     Handle                             dataHandle;
  281.     StringHandle                     titleHandle;
  282.     short                             titleWidth;
  283.     ControlHandle                     controlList;
  284.     CWindowPeek                     nextWindow;
  285.     PicHandle                         windowPic;
  286.     long                             refCon;
  287. };
  288.  
  289. /*
  290.   _________________________________________________________________________________________________________
  291.    • AUXWINDHANDLE
  292.   _________________________________________________________________________________________________________
  293. */
  294. typedef struct AuxWinRec                 AuxWinRec;
  295. typedef AuxWinRec *                        AuxWinPtr;
  296. typedef AuxWinPtr *                        AuxWinHandle;
  297. struct AuxWinRec {
  298.     AuxWinHandle                     awNext;                        /*handle to next AuxWinRec*/
  299.     WindowPtr                         awOwner;                    /*ptr to window */
  300.     CTabHandle                         awCTable;                    /*color table for this window*/
  301.     Handle                             reserved;
  302.     long                             awFlags;                    /*reserved for expansion*/
  303.     CTabHandle                         awReserved;                    /*reserved for expansion*/
  304.     long                             awRefCon;                    /*user Constant*/
  305. };
  306.  
  307. /*
  308.   _________________________________________________________________________________________________________
  309.    • WSTATEHANDLE
  310.   _________________________________________________________________________________________________________
  311. */
  312. struct WStateData {
  313.     Rect                             userState;                    /*user state*/
  314.     Rect                             stdState;                    /*standard state*/
  315. };
  316. typedef struct WStateData WStateData;
  317.  
  318. typedef WStateData *                    WStateDataPtr;
  319. typedef WStateDataPtr *                    WStateDataHandle;
  320. /*
  321.   _________________________________________________________________________________________________________
  322.       
  323.    • API
  324.   _________________________________________________________________________________________________________
  325. */
  326. EXTERN_API( void )
  327. InitWindows                        (void)                                                        ONEWORDINLINE(0xA912);
  328.  
  329. EXTERN_API( WindowPtr )
  330. NewWindow                        (void *                    wStorage,
  331.                                  const Rect *            boundsRect,
  332.                                  ConstStr255Param         title,
  333.                                  Boolean                 visible,
  334.                                  short                     theProc,
  335.                                  WindowPtr                 behind,
  336.                                  Boolean                 goAwayFlag,
  337.                                  long                     refCon)                                ONEWORDINLINE(0xA913);
  338.  
  339. EXTERN_API( WindowPtr )
  340. GetNewWindow                    (short                     windowID,
  341.                                  void *                    wStorage,
  342.                                  WindowPtr                 behind)                                ONEWORDINLINE(0xA9BD);
  343.  
  344. EXTERN_API( WindowPtr )
  345. NewCWindow                        (void *                    wStorage,
  346.                                  const Rect *            boundsRect,
  347.                                  ConstStr255Param         title,
  348.                                  Boolean                 visible,
  349.                                  short                     procID,
  350.                                  WindowPtr                 behind,
  351.                                  Boolean                 goAwayFlag,
  352.                                  long                     refCon)                                ONEWORDINLINE(0xAA45);
  353.  
  354. EXTERN_API( void )
  355. DisposeWindow                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA914);
  356.  
  357. EXTERN_API( void )
  358. CloseWindow                        (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA92D);
  359.  
  360. EXTERN_API( void )
  361. InvalRect                        (const Rect *            badRect)                            ONEWORDINLINE(0xA928);
  362.  
  363. EXTERN_API( void )
  364. InvalRgn                        (RgnHandle                 badRgn)                                ONEWORDINLINE(0xA927);
  365.  
  366. EXTERN_API( void )
  367. ValidRect                        (const Rect *            goodRect)                            ONEWORDINLINE(0xA92A);
  368.  
  369. EXTERN_API( void )
  370. ValidRgn                        (RgnHandle                 goodRgn)                            ONEWORDINLINE(0xA929);
  371.  
  372. EXTERN_API( Boolean )
  373. CheckUpdate                        (EventRecord *            theEvent)                            ONEWORDINLINE(0xA911);
  374.  
  375. EXTERN_API( void )
  376. ClipAbove                        (WindowPtr                 window)                                ONEWORDINLINE(0xA90B);
  377.  
  378. EXTERN_API( void )
  379. SaveOld                            (WindowPtr                 window)                                ONEWORDINLINE(0xA90E);
  380.  
  381. EXTERN_API( void )
  382. DrawNew                            (WindowPtr                 window,
  383.                                  Boolean                 update)                                ONEWORDINLINE(0xA90F);
  384.  
  385. EXTERN_API( void )
  386. PaintOne                        (WindowPtr                 window,
  387.                                  RgnHandle                 clobberedRgn)                        ONEWORDINLINE(0xA90C);
  388.  
  389. EXTERN_API( void )
  390. PaintBehind                        (WindowPtr                 startWindow,
  391.                                  RgnHandle                 clobberedRgn)                        ONEWORDINLINE(0xA90D);
  392.  
  393. EXTERN_API( void )
  394. CalcVis                            (WindowPtr                 window)                                ONEWORDINLINE(0xA909);
  395.  
  396. EXTERN_API( void )
  397. CalcVisBehind                    (WindowPtr                 startWindow,
  398.                                  RgnHandle                 clobberedRgn)                        ONEWORDINLINE(0xA90A);
  399.  
  400. EXTERN_API( void )
  401. SetWinColor                        (WindowPtr                 theWindow,
  402.                                  WCTabHandle             newColorTable)                        ONEWORDINLINE(0xAA41);
  403.  
  404. EXTERN_API( void )
  405. SetDeskCPat                        (PixPatHandle             deskPixPat)                            ONEWORDINLINE(0xAA47);
  406.  
  407. EXTERN_API( WindowPtr )
  408. GetNewCWindow                    (short                     windowID,
  409.                                  void *                    wStorage,
  410.                                  WindowPtr                 behind)                                ONEWORDINLINE(0xAA46);
  411.  
  412. EXTERN_API( void )
  413. SetWTitle                        (WindowPtr                 theWindow,
  414.                                  ConstStr255Param         title)                                ONEWORDINLINE(0xA91A);
  415.  
  416. EXTERN_API( void )
  417. GetWTitle                        (WindowPtr                 theWindow,
  418.                                  Str255                 title)                                ONEWORDINLINE(0xA919);
  419.  
  420. EXTERN_API( void )
  421. GetWMgrPort                        (GrafPtr *                wPort)                                ONEWORDINLINE(0xA910);
  422.  
  423. EXTERN_API( void )
  424. GetCWMgrPort                    (CGrafPtr *                wMgrCPort)                            ONEWORDINLINE(0xAA48);
  425.  
  426. EXTERN_API( void )
  427. SetWRefCon                        (WindowPtr                 theWindow,
  428.                                  long                     data)                                ONEWORDINLINE(0xA918);
  429.  
  430. EXTERN_API( long )
  431. GetWRefCon                        (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA917);
  432.  
  433. EXTERN_API( void )
  434. SelectWindow                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA91F);
  435.  
  436. EXTERN_API( void )
  437. HideWindow                        (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA916);
  438.  
  439. EXTERN_API( void )
  440. ShowWindow                        (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA915);
  441.  
  442. EXTERN_API( void )
  443. ShowHide                        (WindowPtr                 theWindow,
  444.                                  Boolean                 showFlag)                            ONEWORDINLINE(0xA908);
  445.  
  446. EXTERN_API( void )
  447. HiliteWindow                    (WindowPtr                 theWindow,
  448.                                  Boolean                 fHilite)                            ONEWORDINLINE(0xA91C);
  449.  
  450. EXTERN_API( void )
  451. BringToFront                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA920);
  452.  
  453. EXTERN_API( void )
  454. SendBehind                        (WindowPtr                 theWindow,
  455.                                  WindowPtr                 behindWindow)                        ONEWORDINLINE(0xA921);
  456.  
  457. EXTERN_API( WindowPtr )
  458. FrontWindow                        (void)                                                        ONEWORDINLINE(0xA924);
  459.  
  460. EXTERN_API( void )
  461. DrawGrowIcon                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA904);
  462.  
  463. EXTERN_API( void )
  464. MoveWindow                        (WindowPtr                 theWindow,
  465.                                  short                     hGlobal,
  466.                                  short                     vGlobal,
  467.                                  Boolean                 front)                                ONEWORDINLINE(0xA91B);
  468.  
  469. EXTERN_API( void )
  470. SizeWindow                        (WindowPtr                 theWindow,
  471.                                  short                     w,
  472.                                  short                     h,
  473.                                  Boolean                 fUpdate)                            ONEWORDINLINE(0xA91D);
  474.  
  475. EXTERN_API( void )
  476. ZoomWindow                        (WindowPtr                 theWindow,
  477.                                  short                     partCode,
  478.                                  Boolean                 front)                                ONEWORDINLINE(0xA83A);
  479.  
  480. EXTERN_API( void )
  481. BeginUpdate                        (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA922);
  482.  
  483. EXTERN_API( void )
  484. EndUpdate                        (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA923);
  485.  
  486. EXTERN_API( void )
  487. SetWindowPic                    (WindowPtr                 theWindow,
  488.                                  PicHandle                 pic)                                ONEWORDINLINE(0xA92E);
  489.  
  490. EXTERN_API( PicHandle )
  491. GetWindowPic                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA92F);
  492.  
  493. EXTERN_API( long )
  494. GrowWindow                        (WindowPtr                 theWindow,
  495.                                  Point                     startPt,
  496.                                  const Rect *            bBox)                                ONEWORDINLINE(0xA92B);
  497.  
  498. EXTERN_API( short )
  499. FindWindow                        (Point                     thePoint,
  500.                                  WindowPtr *            theWindow)                            ONEWORDINLINE(0xA92C);
  501.  
  502. EXTERN_API( long )
  503. PinRect                            (const Rect *            theRect,
  504.                                  Point                     thePt)                                ONEWORDINLINE(0xA94E);
  505.  
  506. EXTERN_API( long )
  507. DragGrayRgn                        (RgnHandle                 theRgn,
  508.                                  Point                     startPt,
  509.                                  const Rect *            limitRect,
  510.                                  const Rect *            slopRect,
  511.                                  short                     axis,
  512.                                  DragGrayRgnUPP         actionProc)                            ONEWORDINLINE(0xA905);
  513.  
  514. EXTERN_API( long )
  515. DragTheRgn                        (RgnHandle                 theRgn,
  516.                                  Point                     startPt,
  517.                                  const Rect *            limitRect,
  518.                                  const Rect *            slopRect,
  519.                                  short                     axis,
  520.                                  DragGrayRgnUPP         actionProc)                            ONEWORDINLINE(0xA926);
  521.  
  522. EXTERN_API( Boolean )
  523. TrackBox                        (WindowPtr                 theWindow,
  524.                                  Point                     thePt,
  525.                                  short                     partCode)                            ONEWORDINLINE(0xA83B);
  526.  
  527. EXTERN_API( Boolean )
  528. TrackGoAway                        (WindowPtr                 theWindow,
  529.                                  Point                     thePt)                                ONEWORDINLINE(0xA91E);
  530.  
  531. EXTERN_API( void )
  532. DragWindow                        (WindowPtr                 theWindow,
  533.                                  Point                     startPt,
  534.                                  const Rect *            boundsRect)                            ONEWORDINLINE(0xA925);
  535.  
  536. EXTERN_API( short )
  537. GetWVariant                        (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA80A);
  538.  
  539. EXTERN_API( Boolean )
  540. GetAuxWin                        (WindowPtr                 theWindow,
  541.                                  AuxWinHandle *            awHndl)                                ONEWORDINLINE(0xAA42);
  542.  
  543. EXTERN_API( RgnHandle )
  544. GetGrayRgn                        (void)                                                        TWOWORDINLINE(0x2EB8, 0x09EE);
  545.  
  546. /*
  547.   _________________________________________________________________________________________________________
  548.       
  549.    • PROCS
  550.   _________________________________________________________________________________________________________
  551. */
  552.  
  553. typedef CALLBACK_API( long , WindowDefProcPtr )(short varCode, WindowPtr theWindow, short message, long param);
  554. typedef CALLBACK_API( void , DeskHookProcPtr )(Boolean mouseClick, EventRecord *theEvent);
  555. /*
  556.     WARNING: DeskHookProcPtr uses register based parameters under classic 68k
  557.              and cannot be written in a high-level language without 
  558.              the help of mixed mode or assembly glue.
  559. */
  560. typedef STACK_UPP_TYPE(WindowDefProcPtr)                         WindowDefUPP;
  561. typedef REGISTER_UPP_TYPE(DeskHookProcPtr)                         DeskHookUPP;
  562. enum { uppWindowDefProcInfo = 0x00003BB0 };                     /* pascal 4_bytes Func(2_bytes, 4_bytes, 2_bytes, 4_bytes) */
  563. enum { uppDeskHookProcInfo = 0x00130802 };                         /* register no_return_value Func(1_byte:D0, 4_bytes:A0) */
  564. #define NewWindowDefProc(userRoutine)                             (WindowDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppWindowDefProcInfo, GetCurrentArchitecture())
  565. #define NewDeskHookProc(userRoutine)                             (DeskHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDeskHookProcInfo, GetCurrentArchitecture())
  566. #define CallWindowDefProc(userRoutine, varCode, theWindow, message, param)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppWindowDefProcInfo, (varCode), (theWindow), (message), (param))
  567. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  568.     #pragma parameter CallDeskHookProc(__A1, __D0, __A0)
  569.     void CallDeskHookProc(DeskHookUPP routine, Boolean mouseClick, EventRecord * theEvent) = 0x4E91;
  570. #else
  571.     #define CallDeskHookProc(userRoutine, mouseClick, theEvent)  CALL_TWO_PARAMETER_UPP((userRoutine), uppDeskHookProcInfo, (mouseClick), (theEvent))
  572. #endif
  573. /*
  574.   _________________________________________________________________________________________________________
  575.       
  576.    • C GLUE
  577.   _________________________________________________________________________________________________________
  578. */
  579. #if CGLUESUPPORTED
  580. EXTERN_API_C( void )
  581. setwtitle                        (WindowPtr                 theWindow,
  582.                                  const char *            title);
  583.  
  584. EXTERN_API_C( Boolean )
  585. trackgoaway                        (WindowPtr                 theWindow,
  586.                                  Point *                thePt);
  587.  
  588. EXTERN_API_C( short )
  589. findwindow                        (Point *                thePoint,
  590.                                  WindowPtr *            theWindow);
  591.  
  592. EXTERN_API_C( void )
  593. getwtitle                        (WindowPtr                 theWindow,
  594.                                  char *                    title);
  595.  
  596. EXTERN_API_C( long )
  597. growwindow                        (WindowPtr                 theWindow,
  598.                                  Point *                startPt,
  599.                                  const Rect *            bBox);
  600.  
  601. EXTERN_API_C( WindowPtr )
  602. newwindow                        (void *                    wStorage,
  603.                                  const Rect *            boundsRect,
  604.                                  const char *            title,
  605.                                  Boolean                 visible,
  606.                                  short                     theProc,
  607.                                  WindowPtr                 behind,
  608.                                  Boolean                 goAwayFlag,
  609.                                  long                     refCon);
  610.  
  611. EXTERN_API_C( WindowPtr )
  612. newcwindow                        (void *                    wStorage,
  613.                                  const Rect *            boundsRect,
  614.                                  const char *            title,
  615.                                  Boolean                 visible,
  616.                                  short                     procID,
  617.                                  WindowPtr                 behind,
  618.                                  Boolean                 goAwayFlag,
  619.                                  long                     refCon);
  620.  
  621. EXTERN_API_C( long )
  622. pinrect                            (const Rect *            theRect,
  623.                                  Point *                thePt);
  624.  
  625. EXTERN_API_C( Boolean )
  626. trackbox                        (WindowPtr                 theWindow,
  627.                                  Point *                thePt,
  628.                                  short                     partCode);
  629.  
  630. EXTERN_API_C( long )
  631. draggrayrgn                        (RgnHandle                 theRgn,
  632.                                  Point *                startPt,
  633.                                  const Rect *            boundsRect,
  634.                                  const Rect *            slopRect,
  635.                                  short                     axis,
  636.                                  DragGrayRgnUPP         actionProc);
  637.  
  638. EXTERN_API_C( void )
  639. dragwindow                        (WindowPtr                 theWindow,
  640.                                  Point *                startPt,
  641.                                  const Rect *            boundsRect);
  642.  
  643. #endif  /* CGLUESUPPORTED */
  644.  
  645. /*
  646.   _________________________________________________________________________________________________________
  647.       
  648.    • WindowRecord accessor macros
  649.   _________________________________________________________________________________________________________
  650. */
  651. /*
  652.     *****************************************************************************
  653.     *                                                                           *
  654.     * The conditional STRICT_WINDOWS has been removed from this interface file. *
  655.     * The accessor macros to a WindowRecord are no longer necessary.            *
  656.     *                                                                           *
  657.     * All ≈Ref Types have reverted to their original Handle and Ptr Types.      *
  658.     *                                                                           *
  659.     *****************************************************************************
  660.  
  661.     Details:
  662.     The original purpose of the STRICT_ conditionals and accessor macros was to
  663.     help ease the transition to Copland.  Shared data structures are difficult
  664.     to coordinate in a preemptive multitasking OS.  By hiding the fields in a
  665.     WindowRecord and other data structures, we would begin the migration to the
  666.     discipline wherein system data structures are completely hidden from
  667.     applications.
  668.     
  669.     After many design reviews, we finally concluded that with this sort of
  670.     migration, the system could never tell when an application was no longer
  671.     peeking at a WindowRecord, and thus the data structure might never become
  672.     system owned.  Additionally, there were many other limitations in the
  673.     classic toolbox that were begging to be addressed.  The final decision was
  674.     to leave the traditional toolbox as a compatibility mode.
  675.     
  676.     We also decided to use the Handle and Ptr based types in the function
  677.     declarations.  For example, NewWindow now returns a WindowPtr rather than a
  678.     WindowRef.  The Ref types are still defined in the header files, so all
  679.     existing code will still compile exactly as it did before.  There are
  680.     several reasons why we chose to do this:
  681.     
  682.     - The importance of backwards compatibility makes it unfeasible for us to
  683.     enforce real opaque references in the implementation anytime in the
  684.     foreseeable future.  Therefore, any opaque data types (e.g. WindowRef,
  685.     ControlRef, etc.) in the documentation and header files would always be a
  686.     fake veneer of opacity.
  687.     
  688.     - There exists a significant base of books and sample code that neophyte
  689.     Macintosh developers use to learn how to program the Macintosh.  These
  690.     books and sample code all use direct data access.  Introducing opaque data
  691.     types at this point would confuse neophyte programmers more than it would
  692.     help them.
  693.     
  694.     - Direct data structure access is used by nearly all Macintosh developers. 
  695.     Changing the interfaces to reflect a false opacity would not provide any
  696.     benefit to these developers.
  697.     
  698.     - Accessor functions are useful in and of themselves as convenience
  699.     functions, without being tied to opaque data types.  We will complete and
  700.     document the Windows and Dialogs accessor functions in an upcoming release
  701.     of the interfaces.
  702. */
  703. #ifdef __cplusplus
  704. inline CGrafPtr    GetWindowPort(WindowPtr w)                     { return (CGrafPtr) w;                                                     }
  705. inline void        SetPortWindowPort(WindowPtr w)                {    SetPort( (GrafPtr) GetWindowPort(w)); }
  706. inline SInt16        GetWindowKind(WindowPtr w)                     { return ( *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)));             }
  707. inline void        SetWindowKind(WindowPtr    w, SInt16 wKind)    {  *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)) = wKind;              }
  708. inline    Boolean        IsWindowVisible(WindowPtr w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x2);         }
  709. inline Boolean        IsWindowHilited(WindowPtr w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x3);        }
  710. inline Boolean        GetWindowGoAwayFlag(WindowPtr w)            { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x4);        }
  711. inline Boolean        GetWindowZoomFlag(WindowPtr w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x5);        }
  712. inline void        GetWindowStructureRgn(WindowPtr w, RgnHandle r)    {    CopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0x6), r );    }
  713. inline void        GetWindowContentRgn(WindowPtr w, RgnHandle r)    {    CopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xA), r );    }
  714. inline void        GetWindowUpdateRgn(WindowPtr w, RgnHandle r)    {    CopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xE), r );    }
  715. inline SInt16        GetWindowTitleWidth(WindowPtr w)                { return *(SInt16 *)(((UInt8 *) w) + sizeof(GrafPort) + 0x1E);            }
  716. inline WindowPtr    GetNextWindow(WindowPtr w)                        { return *(WindowPtr *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x24);        }
  717.  
  718. inline void    GetWindowStandardState(WindowPtr w, Rect *r)
  719. {    Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  720. if (stateRects != NULL)    *r = stateRects[1];        }
  721. inline void    SetWindowStandardState(WindowPtr w, const Rect *r)
  722. {     Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  723. if (stateRects != NULL)    stateRects[1] = *r;     }
  724. inline void    GetWindowUserState(WindowPtr w, Rect *r)
  725. {     Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  726. if (stateRects != NULL)    *r = stateRects[0]; }
  727. inline void    SetWindowUserState(WindowPtr w, const Rect *r)
  728. { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  729. if (stateRects != NULL)    stateRects[0] = *r; }
  730. #else
  731. #define ShowHideWindow(w)                        ShowHide(w)
  732. #define SetPortWindowPort(w)                    SetPort( (GrafPtr) GetWindowPort(w) )
  733. #define GetWindowPort(w)                        ( (CGrafPtr) w)
  734. #define GetWindowKind(w)                        ( *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)))
  735. #define SetWindowKind(w, wKind)                ( *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)) = wKind )
  736. #define IsWindowVisible(w)                        ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x2))
  737. #define IsWindowHilited(w)                        ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x3))
  738. #define GetWindowGoAwayFlag(w)                    ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x4))
  739. #define GetWindowZoomFlag(w)                    ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x5))
  740. #define GetWindowStructureRgn(w, aRgnHandle)    CopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0x6), aRgnHandle )
  741. #define GetWindowContentRgn(w, aRgnHandle)        CopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xA), aRgnHandle )
  742.  
  743. #define GetWindowUpdateRgn(w, aRgnHandle)        CopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xE), aRgnHandle )
  744.  
  745. #define GetWindowTitleWidth(w)                    ( *(SInt16 *)        (((UInt8 *) w) + sizeof(GrafPort) + 0x1E))
  746. #define GetNextWindow(w)                        ( *(WindowPtr *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x24))
  747.  
  748. #define GetWindowStandardState(w, aRectPtr)    do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  749.                                                                 if (stateRects != NULL)    *aRectPtr = stateRects[1]; } while (false)
  750. #define SetWindowStandardState(w, aRectPtr)    do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  751.                                                                 if (stateRects != NULL)    stateRects[1] = *aRectPtr; } while (false)
  752. #define GetWindowUserState(w, aRectPtr)        do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  753.                                                                 if (stateRects != NULL)    *aRectPtr = stateRects[0]; } while (false)
  754. #define SetWindowUserState(w, aRectPtr)        do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  755.                                                                 if (stateRects != NULL)    stateRects[0] = *aRectPtr; } while (false)
  756. #endif  /*  defined(__cplusplus)  */
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766. #if PRAGMA_STRUCT_ALIGN
  767.     #pragma options align=reset
  768. #elif PRAGMA_STRUCT_PACKPUSH
  769.     #pragma pack(pop)
  770. #elif PRAGMA_STRUCT_PACK
  771.     #pragma pack()
  772. #endif
  773.  
  774. #ifdef PRAGMA_IMPORT_OFF
  775. #pragma import off
  776. #elif PRAGMA_IMPORT
  777. #pragma import reset
  778. #endif
  779.  
  780. #ifdef __cplusplus
  781. }
  782. #endif
  783.  
  784. #endif /* __MACWINDOWS__ */
  785.  
  786.